<?php
/*
* @version 2010-11-03
* @author mxrgus.pxrt
*/


function object_to_array($object, $recursive=true) {
    
    if(is_object($object)){
        $object = (array) $object;
    }

    if($recursive) {
        if(is_array($object)){
            // TODO: could not get reference working, fix it - PHP4 :'(
            foreach($object as $key=>$val){
                $object[$key]   = object_to_array(&$val, true);
            }
        }
    }

    return $object;
}

